
{block name="main"}
<div class="breadcrumbs" id="breadcrumbs">
    <script type="text/javascript">
        try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
    </script>

    <ul class="breadcrumb">
        <li>
            <i class="icon-home home-icon"></i>
            <a href="{:url('admin/index/index')}">首页</a>
        </li>

        <li>文章管理</li>
        <li class="active">添加文章</li>
    </ul><!-- .breadcrumb -->

</div>
<div class="container" style="margin-top: 30px;">
    <div class="row">
        <div class="col-xs-12">
            <!-- PAGE CONTENT BEGINS -->
            <form class="form-horizontal" id="add-form"  role="form" action="{:url('admin/banners/add')}" method="post" onsubmit="return reForm();" enctype="multipart/form-data">

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="link"> 链接： </label>
                    <div class="col-sm-9">
                        <input type="text" id="link" placeholder="名称" onblur="reLink();" name="link" class="col-xs-10 col-sm-5" />
                        <span class="help-inline col-xs-12 col-sm-7">
                        <span class="middle">*必填</span>
                    </span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="title"> 标题： </label>
                    <div class="col-sm-9">
                        <input type="text" id="title" placeholder="名称" onblur="reTitle();" name="title" class="col-xs-10 col-sm-5" />
                        <span class="help-inline col-xs-12 col-sm-7">
                        <span class="middle">*必填</span>
                    </span>
                    </div>
                </div>



                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right"> 封面： </label>
                    <div class="col-sm-9">
                        <input type="file" name="pic" id="pic">
                        </span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right"> 状态： </label>
                    <div class="col-sm-9">
                        <label>启用：<input  type="radio"  checked  name="status" value="1"/></label>
                        <label style="margin-left: 20px;">禁用：<input  type="radio"  name="status" value="0" /></label>
                    </div>
                </div>


                <div class="clearfix">
                    <div class="col-md-offset-3 col-md-9">
                        <button class="btn btn-info btn-doadd" type="submit">
                            <i class="icon-ok bigger-110"></i>
                            提交
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>


    <script>

        $(function(){
            $('#link').focus();
        });

        function reLink(){
            var link = $('#link').val();
            if(link.length > 60 || link.length <=0){
                $('.middle').eq(0).html('1到60字符').css({'color': 'red'});
                return false;
            }else{
                $('.middle').eq(0).html('正确').css({'color': 'green'});
                return true;
            }
        }

        function reTitle(){
            var title = $('#title').val();
            if(!/^([a-zA-Z0-9\u4e00-\u9fa5\· \,\。\.\!]{1,30})$/.test(title)){
                $('.middle').eq(1).html('不能包含特殊符号。1到30字符').css({'color': 'red'});
                return false;
            }else{
                $('.middle').eq(1).html('正确').css({'color': 'green'});
                return true;
            }
        }


        function  reForm() {

            return reTitle() && reLink();
        }


    </script>




    {/block}